package com.springmvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/*
 * RequestMapping类标记：限定处理器处理所有URl为/requestMapping下的请求
 * 相对于web容器部署的根路径
 */
@RequestMapping("/requestMapping")  
@Controller
public class RequestMappingController {

	/*
	 * 处理器可以定义多个处理方法，处理来自类标记/requestMapping下的请求
	 */
	@RequestMapping("/request")
	public String requestMapping(){
		System.out.println("RequestMapping");
		return "requestSuccess";
	}
	
	/*
	 * 使用method指定请求方式
	 */
	@RequestMapping(value="/testMethod",method=RequestMethod.POST)
	public String testMethod(){
		System.out.println("testMethod");
		return "testMethod";
	}
	
	
	@RequestMapping(value="/testParamsHeaders",params={"name","age!=10"},headers={"Accept-Language:zh-CN,zh;q=0.8"})
	public String testParamsHeaders(){
		System.out.println("testParamsHeaders");
		return "testParamsHeaders";
	}
}
